package nl.sodeso.cubicex.command.assertion;

import java.util.Map;
import java.util.StringTokenizer;

import org.cubictest.selenium.custom.IElementContext;

import com.thoughtworks.selenium.Selenium;

import nl.sodeso.cubicex.CubicExBaseTestCase;

/**
 * Replaces the <code>getSelectOptions</code> command of SeleniumIDE
 * 
 * @author y.bittan
 * @since 0.0.4
 */
public class AssertNotSelectOptions extends CubicExBaseTestCase{

	/**
	 * {@inheritDoc}
	 */
	public void executeTest(Map<String, String> arguments,
			IElementContext context, Selenium selenium) throws Exception {
		
		String _string=getArgAsString("strings");
		String _locator=getArgTarget();
		
		StringTokenizer tokens=new StringTokenizer(_string,",");
		
		String [] tab=selenium.getSelectOptions(_locator);
		
		int i=0;
		while (tokens.hasMoreTokens()){
			if (i >= tab.length){
				assertEquals(false, true); // false assert !
				break;
			}
			String t=tokens.nextToken();
			assertNotEquals(t, tab[i]);
			i++;
		}
		

		
	}

}
